package item.service.impl;

import java.util.List;

import org.apache.poi.ss.formula.functions.Code;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.excel.event.Order;

import item.bean.Rentals;
import item.dao.RentalsDao;
import item.service.IRentalsService;
import item.util.Page;
import item.util.SnowflakeIdGenerator;

@Service
public class RentalsService implements IRentalsService{
	@Autowired 
	RentalsDao aa;
	
	 private final SnowflakeIdGenerator idGenerator;

	    @Autowired
	    public RentalsService(RentalsDao orderMapper, SnowflakeIdGenerator idGenerator) {
	        this.aa = orderMapper;
	        this.idGenerator = idGenerator;
	    }
	public List<Rentals> getRentals(Rentals rentals, Page page) {
		return aa.getRentals(rentals,page);
	}
	public int getCount(Rentals rentals) {
		return aa.getCount(rentals);
	}
	public int addRentalsMes(Rentals rentals) {
		long code=idGenerator.generateId();
		rentals.setCode(String.valueOf(code));
		return aa.addRentalsMes(rentals);
	}
	public int delRentals(int id) {
		return aa.delRentals(id);
	}
	public int editRentals(Rentals rentals) {
		return aa.editRentals(rentals);
	}
	public int deleteRentals(int id) {
		return aa.deleteRentals(id);
	}
	public Rentals getRentalsById(int id) {
		return aa.getRentalsById(id);
	}
	public int editRentalImgByID(Rentals rentals) {
		return aa.editRentalImgByID(rentals);
	}
	public List<Rentals> getCustomerRentalStatusByuserid(Rentals rentals) {
		return aa.getCustomerRentalStatusByuserid(rentals);
	}
	public int getLastId() {
		return aa.getLastId();
	}
	public int editcode(Code code, int id) {
		return aa.editcode(code, id);
	}
}
